﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="Mechanisms.aspx.cs" Inherits="PmSadis.WebFormsUi.Operator.Mechanisms" %>

<%@ Register Assembly="DevExpress.Web.ASPxGridView.v11.2, Version=11.2.10.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridLookup" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v11.2, Version=11.2.10.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
<%--<asp:Content ID="mechanismsHead" ContentPlaceHolderID="head" runat="server">
</asp:Content>--%>
<asp:Content ID="mechanismsContent" ContentPlaceHolderID="content" runat="server">
    <link href="../Content/oper.mechanisms.css" rel="stylesheet" type="text/css" />
    <h2>
        Механизмы</h2>
    <asp:ScriptManager ID="mechanismsScriptManager" runat="server" />
    <!--mechanismx data source-->
    <asp:ObjectDataSource ID="dsMechanisms" runat="server" TypeName="PmSadis.WebFormsUi.Operator.Mechanisms"
        SelectMethod="AllMechanisms" InsertMethod="InsertMechanism" UpdateMethod="UpdateMechanism"
        DeleteMethod="DeleteMechanism" />
    <!--units data source-->
    <asp:ObjectDataSource ID="dsUnits" runat="server" TypeName="PmSadis.WebFormsUi.Operator.Mechanisms"
        SelectMethod="Units" />
    <asp:UpdatePanel ID="mechanismsUpdatePanel" runat="server">
        <ContentTemplate>
            <dx:ASPxGridView ID="gvMechanisms" runat="server" OnInit="gvMechanisms_Init" DataSourceID="dsMechanisms"
                KeyFieldName="MechanismId" OnRowInserting="gvMechanisms_RowInserting" OnRowUpdating="gvMechanisms_RowUpdating">
                <Columns>
                    <dx:GridViewDataDateColumn FieldName="DateCreate" Visible="false" />
                    <dx:GridViewCommandColumn>
                        <NewButton Visible="true" />
                        <EditButton Visible="true" />
                        <DeleteButton Visible="true" />
                    </dx:GridViewCommandColumn>
                    <dx:GridViewDataTextColumn Caption="Наименование механизма" FieldName="Name" />
                    <dx:GridViewDataTextColumn Caption="Код" FieldName="Code" />
                    <dx:GridViewDataSpinEditColumn FieldName="CostBase" Caption="Базовая стоиомость">
                        <PropertiesSpinEdit DisplayFormatString="{0:c}" DecimalPlaces="2" />
                    </dx:GridViewDataSpinEditColumn>
                    <dx:GridViewDataComboBoxColumn FieldName="UnitId" Caption="Единица измерения">
                        <EditItemTemplate>
                            <dx:ASPxGridLookup ID="lucUnits" runat="server" DataSourceID="dsUnits" KeyFieldName="UnitId"
                                Width="100%" OnInit="lucUnits_Init" SelectionMode="Single">
                                <GridViewProperties>
                                    <Settings ShowFilterRow="true" ShowFilterRowMenu="true" />
                                </GridViewProperties>
                                <Columns>
                                    <dx:GridViewCommandColumn Caption="Выбрать" ShowSelectCheckbox="true" Width="50" />
                                    <dx:GridViewDataTextColumn FieldName="Name" Caption="Наименование" />
                                </Columns>
                            </dx:ASPxGridLookup>
                        </EditItemTemplate>
                        <PropertiesComboBox DataSourceID="dsUnits" ValueField="UnitId" ValueType="System.Int32"
                            TextField="Name" />
                    </dx:GridViewDataComboBoxColumn>
                </Columns>
            </dx:ASPxGridView>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
